package com.vctgo.currency.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.vctgo.currency.mapper.TbCurrencyMapper;
import com.vctgo.currency.domain.TbCurrency;
import com.vctgo.currency.service.ITbCurrencyService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vctgo.common.core.text.Convert;
import com.vctgo.common.core.utils.ServletUtils;
import com.vctgo.common.mybatisplus.constant.MybatisPageConstants;
/**
 * 币别Service业务层处理
 *
 * @author vctgo
 * @date 2024-12-17
 */
@Service
public class TbCurrencyServiceImpl implements ITbCurrencyService
{
    @Autowired
    private TbCurrencyMapper tbCurrencyMapper;

    /**
     * 查询币别
     *
     * @param id 币别主键
     * @return 币别
     */
    @Override
    public TbCurrency selectTbCurrencyById(Long id)
    {
        return tbCurrencyMapper.selectById(id);
    }

    /**
     * 查询币别列表-分页
     *
     * @param tbCurrency 币别
     * @return 币别
     */
    @Override
    public IPage<TbCurrency> selectTbCurrencyPage(TbCurrency tbCurrency)
    {
        Page mpPage =new Page(Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_NUM),1L)
                ,Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_SIZE),10L));
        return tbCurrencyMapper.selectTbCurrencyList(mpPage,tbCurrency);
    }
    /**
     * 查询币别列表
     *
     * @param tbCurrency 币别
     * @return 币别
     */
    @Override
    public List<TbCurrency> selectTbCurrencyList(TbCurrency tbCurrency)
    {
        return tbCurrencyMapper.selectTbCurrencyList(tbCurrency);
    }

    /**
     * 新增币别
     *
     * @param tbCurrency 币别
     * @return 结果
     */

    @Override
    public int insertTbCurrency(TbCurrency tbCurrency)
    {
        return tbCurrencyMapper.insert(tbCurrency);
    }

    /**
     * 修改币别
     *
     * @param tbCurrency 币别
     * @return 结果
     */
    @Override
    public int updateTbCurrency(TbCurrency tbCurrency)
    {
        return tbCurrencyMapper.updateById(tbCurrency);
    }

    /**
     * 批量删除币别
     *
     * @param ids 需要删除的币别主键
     * @return 结果
     */
    @Override
    public int deleteTbCurrencyByIds(Long[] ids)
    {
        return tbCurrencyMapper.deleteTbCurrencyByIds(ids);
    }

    /**
     * 删除币别信息
     *
     * @param id 币别主键
     * @return 结果
     */
    @Override
    public int deleteTbCurrencyById(Long id)
    {
        return tbCurrencyMapper.deleteById(id);
    }
}
